package com.linln.admin.app.repository;

import com.linln.admin.app.domain.VersionMember;
import com.linln.common.config.BaseRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface VersionMemberRepository extends BaseRepository<VersionMember, Long> {

    @Modifying
    @Query("delete from #{#entityName} where version_id = ?1 ")
    void deleteByVersionId(Long id);


    @Query(nativeQuery = true, value = "select user_id from app_version_member where version_id=:versionId")
    List<Long> findVersionMembers(@Param("versionId") Long versionId);
}
